<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:57:"E:\www\sunwm\web/../application/admin\view\auth\edit.html";i:1510361455;s:61:"E:\www\sunwm\web/../application/admin\view\Public\header.html";i:1503189484;s:61:"E:\www\sunwm\web/../application/admin\view\Public\footer.html";i:1512624954;}*/ ?>
﻿<!DOCTYPE html>
<html lang="zh-cn">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<title><?php echo config('sitename'); ?>-<?php echo lang('label')['Login_title']; ?></title>
		<link rel="stylesheet" type="text/css" href="__ROOT__/static/public/css/pintuer.css" />
		<link rel="stylesheet" type="text/css" href="__ROOT__/static/admin/css/admin.css" />
		<script type="text/javascript" src="__ROOT__/static/public/js/jquery.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/js/pintuer.js"></script>
		<script type="text/javascript" src="__ROOT__/static/admin/js/admin.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/layer/layer.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/laydate/laydate.js"></script>
		<script type="text/javascript" src="__ROOT__/static/public/laytpl/laytpl.js"></script>
	</head>

	<body>
	<style>
		html { overflow-x:hidden; }
	</style>
<style>
	label{
		color: #000;
	}
</style>
<form method="post" class="form-x" action="<?php if($data['id']): ?>?id=<?php echo $data['id']; endif; ?>" style="color: #000">
	<div class="panel admin-panel">
		<div class="panel-head"></div>
		<br/>
		<div class="form-group">
			<div class="label">
				<label for="type"><?php echo lang('label')['type']; ?></label>
			</div>
			<div class="field">
				<select class="input input-auto" id="type" name="type">
					<option>请选择</option>
					<?php if(input('session.type') == 'all'): ?>
					<option <?php if($data['type'] =='all'): ?> selected <?php endif; ?> value="all">总管理</option>
					<?php endif; if(input('session.type') == 'province' || input('session.type') == 'all'): ?>
					<option <?php if($data['type'] == 'province'): ?> selected <?php endif; ?> value="province">省管理</option>
					<?php endif; if(input('session.type') == 'province' ||  input('session.type') == 'city' || input('session.type') == 'all'): ?>
					<option <?php if($data['type'] == 'city'): ?> selected <?php endif; ?> value="city">市管理</option>
					<?php endif; ?>
					<option <?php if($data['type'] == 'area'): ?> selected <?php endif; ?> value="area">县管理</option>
				</select>
			</div>
		</div>
		<div id="province_box" name="box" class="form-group <?php if($data['type'] != 'province'): ?>hidden<?php endif; ?>">
			<div class="label">
				<label>省</label>
			</div>
			<div class="field">
				<ul class="list-inline" style="max-height: 200px; overflow: auto">
					<?php if(is_array($province) || $province instanceof \think\Collection || $province instanceof \think\Paginator): $i = 0; $__LIST__ = $province;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$province_list): $mod = ($i % 2 );++$i;?>
					<li><input id="<?php echo $province_list['id']; ?>" <?php if($data['aid'] == $province_list['id']): ?>checked<?php endif; ?> name="aid" type="radio" value="<?php echo $province_list['id']; ?>" /><label for="<?php echo $province_list['id']; ?>"><?php echo $province_list['name']; ?></label></input></li>
					<?php endforeach; endif; else: echo "" ;endif; ?>
				</ul>
			</div>
		</div>
		<div id="city_box" name="box" class="form-group <?php if($data['type'] != 'city'): ?>hidden<?php endif; ?>">
			<div class="label">
				<label>市</label>
			</div>
			<div class="field">
				<ul class="list-inline" style="max-height: 200px; overflow: auto">
					<?php if(is_array($city) || $city instanceof \think\Collection || $city instanceof \think\Paginator): $i = 0; $__LIST__ = $city;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$city_list): $mod = ($i % 2 );++$i;?>
					<li><input id="<?php echo $city_list['id']; ?>" <?php if($data['aid'] == $city_list['id']): ?>checked<?php endif; ?> name="aid" type="radio" value="<?php echo $city_list['id']; ?>" /><label for="<?php echo $city_list['id']; ?>"><?php echo $city_list['name']; ?></label></input></li>
					<?php endforeach; endif; else: echo "" ;endif; ?>
				</ul>
			</div>
		</div>
		<div id="area_box" name="box" class="form-group <?php if($data['type'] != 'area'): ?>hidden<?php endif; ?>">
			<div class="label">
				<label>县</label>
			</div>
			<div class="field">
				<ul class="list-inline" style="max-height: 200px; overflow: auto">
					<?php if(is_array($area) || $area instanceof \think\Collection || $area instanceof \think\Paginator): $i = 0; $__LIST__ = $area;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$area_list): $mod = ($i % 2 );++$i;?>
					<li><input id="<?php echo $area_list['id']; ?>" <?php if($data['aid'] == $area_list['id']): ?>checked<?php endif; ?> name="aid" type="radio" value="<?php echo $area_list['id']; ?>" /><label for="<?php echo $area_list['id']; ?>"><?php echo $area_list['name']; ?></label></input></li>
					<?php endforeach; endif; else: echo "" ;endif; ?>
				</ul>
			</div>
		</div>

		<div class="form-group">
			<div class="label">
				<label for="username"><?php echo lang('label')['username']; ?></label>
			</div>
			<div class="field">
				<input type="text" class="input input-auto" id="username" name="username" value="<?php echo $data['username']; ?>" size="80" placeholder="<?php echo lang('label')['username']; ?>" data-validate="required:<?php echo lang('currency')['required']; ?>" />
			</div>
		</div>
		<div class="form-group">
			<div class="label">
				<label for="phone"><?php echo lang('label')['phone']; ?></label>
			</div>
			<div class="field">
				<input type="text" class="input input-auto" id="phone" name="phone" value="<?php echo $data['phone']; ?>" size="80" placeholder="<?php echo lang('label')['phone']; ?>" data-validate="required:<?php echo lang('currency')['required']; ?>" />
			</div>
		</div>
		<div class="form-group">
			<div class="label">
				<label for="password"><?php echo lang('label')['password']; ?></label>
			</div>
			<div class="field">
				<input type="text" class="input input-auto" id="password" name="password" value="" size="80" placeholder="<?php echo lang('label')['password']; ?>" <?php if(!$data['id']): ?>data-validate="required:<?php echo lang('currency')['required']; ?>"<?php endif; ?> />
			</div>
		</div>
		<div class="form-group">
			<input class="hidden" name="auth"/><!--占位-->
			<div class="input-inline clearfix">
				<div class="label">
					<label><?php echo lang('label')['auth']; ?></label>
				</div>
				<?php $session_auth = explode(',',input('session.auth'));$autharray = explode(',',$data['auth']); ?>
				<div class="field">
					<ul class="list-inline">
						<?php if(input('session.type') == 'all'): if(is_array($menu_all) || $menu_all instanceof \think\Collection || $menu_all instanceof \think\Paginator): $i = 0; $__LIST__ = $menu_all;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$volist): $mod = ($i % 2 );++$i;?>
							<li <?php if($i==0): ?>class="active"<?php endif; ?> style="width: 100%">
								<input data-order="<?php echo $i; ?>" id="check<?php echo $i; ?>" class="check" <?php if(in_array($volist['auth'],$autharray)): ?>checked<?php endif; ?> name="auth[]" type="checkbox" value="<?php echo $volist['auth']; ?>" /><label for="check<?php echo $i; ?>"><?php echo $volist['name']; ?></label>
								<ul class="list-inline">
									<?php if(is_array($volist['sub']) || $volist['sub'] instanceof \think\Collection || $volist['sub'] instanceof \think\Paginator): $j = 0; $__LIST__ = $volist['sub'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sublist): $mod = ($j % 2 );++$j;?>
									<li>
										<input id="check<?php echo $i; ?><?php echo $j; ?>" class="checksub checksub<?php echo $i; ?>" <?php if(in_array($sublist['auth'],$autharray)): ?>checked<?php endif; ?> name="auth[]" type="checkbox" value="<?php echo $sublist['auth']; ?>" /><label for="check<?php echo $i; ?><?php echo $j; ?>"><?php echo $sublist['name']; ?></label>
									</li>
									<?php endforeach; endif; else: echo "" ;endif; ?>
								</ul>
							</li>
							<?php endforeach; endif; else: echo "" ;endif; else: if(is_array($menu_all) || $menu_all instanceof \think\Collection || $menu_all instanceof \think\Paginator): $i = 0; $__LIST__ = $menu_all;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$volist): $mod = ($i % 2 );++$i;if(in_array($volist['auth'],$session_auth)): ?>
								<li <?php if($i==0): ?>class="active"<?php endif; ?> style="width: 100%">
									<input data-order="<?php echo $i; ?>" id="check<?php echo $i; ?>" class="check" <?php if(in_array($volist['auth'],$autharray)): ?>checked<?php endif; ?> name="auth[]" type="checkbox" value="<?php echo $volist['auth']; ?>" /><label for="check<?php echo $i; ?>"><?php echo $volist['name']; ?></label>
									<ul class="list-inline">
										<?php if(is_array($volist['sub']) || $volist['sub'] instanceof \think\Collection || $volist['sub'] instanceof \think\Paginator): $j = 0; $__LIST__ = $volist['sub'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sublist): $mod = ($j % 2 );++$j;if(in_array($sublist['auth'],$session_auth)): ?>
											<li>
												<input id="check<?php echo $i; ?><?php echo $j; ?>" class="checksub checksub<?php echo $i; ?>" <?php if(in_array($sublist['auth'],$autharray)): ?>checked<?php endif; ?> name="auth[]" type="checkbox" value="<?php echo $sublist['auth']; ?>" /><label for="check<?php echo $i; ?><?php echo $j; ?>"><?php echo $sublist['name']; ?></label>
											</li>
											<?php endif; endforeach; endif; else: echo "" ;endif; ?>
									</ul>
								</li>
								<?php endif; endforeach; endif; else: echo "" ;endif; endif; ?>
					</ul>
				</div>
			</div>
		</div>
		<div class="form-button">
			<button class="button bg-main" type="submit"><?php echo lang('form')['submit']; ?></button>
		</div>
		<br/>
	</div>
</form>
<script>
	/*$("#type").click(function(){
	 var type = $("#type").val();
	 if(type=='1'){
	 $("#city").addClass('hidden');
	 }else{
	 $("#city").removeClass('hidden');
	 }
	 });*/
    $("#type").change(function () {
        var type = $("#type").val();
        if(type == 'all'){
            $("div[name=box]").attr('class','form-group hidden');
        }else{
            $("div[name=box]").attr('class','form-group hidden');
            $('#'+type+'_box').attr('class','form-group');
        }
    })
    $(".check").click(function(){
        $(".checksub"+$(this).attr('data-order')).prop("checked",$(this).prop("checked"));
    });
    $(".checksub").click(function(){
        if(!$(this).parent().parent().parent().find('input').prop("checked")){
            alert("<?php echo lang('currency')['authtip']; ?>");
            return false;
        }
    });
</script>
<p class="text-center text-gray" style="margin-top:10px;"><a class="text-gray" target="_blank" href="http://www.wm0530.com">完美外卖系统 Power by 网络工厂</a></p>
</body>
<script>
$('.upload').on('click',function (){
		var id = $(this).attr('data-id');
		 upload(id);
	}
);
function upload(id){
	layer.open({
		type:2,
		title:false,
		area: ['70%', '90%'],
		offset: '5%',
		content: "<?php echo url('/admin/material'); ?>?id="+id
	});
}
</script>
</html>